package lesson.threadpool;

import lesson.thread.test6.MyCallable;

import java.util.concurrent.*;

public class MyThreadPoOLDemo2 {
    public static void main(String[] args) throws InterruptedException, ExecutionException {
        ExecutorService es = Executors.newFixedThreadPool(10);

        ThreadPoolExecutor pool = (ThreadPoolExecutor) es;
        System.out.println(pool.getPoolSize());

        es.submit(()-> System.out.println(Thread.currentThread().getName()+"在执行了"));



        es.submit(()-> System.out.println(Thread.currentThread().getName()+"在执行了"));

        System.out.println(pool.getPoolSize());

        MyCallable mc = new MyCallable();
        Future<String> future = es.submit(mc);
        String s = future.get();
        System.out.println(s);
        es.shutdown();
    }
}
